#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include"sdf.h"
#include<time.h>
int SDF_OpenDevice( void ** phDeviceHandle) {
	return SDR_OK;
}
int SDF_CloseDevice( void * hDeviceHandle) {
	return SDR_OK;
}
int SDF_GetDeviceInfo(void * hSessionHandle,DEVICEINFO * pstDeviceInfo) {
	DEVICEINFO di;
	strcpy(di.IssuerName,"yang");
	strcpy(di.DeviceName,"ycySDF");
	strcpy(di.DeviceSerial,"20201212");
	di.DeviceVersion=1;
	(*pstDeviceInfo)= di;

	return SDR_OK;
}
int SDF_GenerateRandom (void * hSessionHandle,unsigned int uiLength,unsigned char * pucRandom) {
	int i=0;
	char number[100];
	srand(time(NULL));
	number[i]=rand()%9+1+'0';

	for(i=1; i<uiLength; i++) {
		number[i]=rand()%10+'0';
	}
	number[uiLength]='\0';
	for(i=0; i<=uiLength; i++) {
		*(pucRandom+i)=number[i];
	}

	//itoa(num, pucRandom, 10);
	printf("pucRandom的值为%s",pucRandom);
	return SDR_OK;
}

